var smslimit=60;
var curlimit=0;
var smssending=false;

function sendsms(m,smstype,targetid){
	if(!smssending && curlimit<=0){
		smssending=true;
		$w.httpRequest({
			url:apiroot+"/user/sendsms",
			data:{"mobile":m,"smstype":smstype},
			ok:function(ret){
				curlimit=smslimit;
				setsmslimit(targetid);
			},all:function(ret){
				smssending=false;
			}
		})
	}
}

function setsmslimit(targetid){
		$("#"+targetid).text("已发送，"+curlimit+"秒");
		curlimit--;
		if(curlimit>0)setTimeout(function(){setsmslimit(targetid);},1000);
		else $("#"+targetid).text("重新发送");
}